import request from '@/utils/request';

/**
 * 头部统计
 */
export async function orderStatistics(data) {
  const res = await request.post('/home/orderStatistics', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 数据统计

export async function amountStatistics(data) {
  const res = await request.post('/home/amountStatistics', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 支付方式统计
export async function payWayStatistics(data) {
  const res = await request.post('home/payWayStatistics', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
//
export async function homePayWayStatistics(data) {
  const res = await request.post('home/payWay', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}

// 支付统计
export async function financeStatistics(data) {
  const res = await request.post('/home/financeStatistics', data);
  if (res.data.code === 0) {
    return res.data;
  }
  return Promise.reject(new Error(res.data.msg));
}
